﻿using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Isis.Model;

namespace Isis.Helpers.Impl
{
    public class AssemblyDetailsHelper
    {
        public AssemblyDetails[] ListApplicationFolderFiles()
        {
            var appFolder = new ApplicationFolder();
            IList<Assembly> myAssemblies = appFolder.ListRunningAssemblies();

            return
                myAssemblies.Select(
                    a =>
                    new AssemblyDetails
                        {
                            IsDebugBuild = a.IsDebugBuild(),
                            Name = a.GetName().Name,
                            VersionString = a.GetName().Version.ToString(4)
                        }).
                    ToArray();
        }
    }
}